package com.yanqu.road.server.manger.activity.recycle;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.ActivityItemRecycleData;
import com.yanqu.road.entity.activity.shushan.config.ShuShanActivityConfig;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.eItemId;
import com.yanqu.road.server.manger.activity.shushan.ShuShanMgr;

import java.util.ArrayList;
import java.util.List;

public class ShuShanRecycleStrategy extends AbstractItemRecycleStrategy {
    @Override
    public void markNeedRecycleItem() {
        ShuShanActivityConfig config = ShuShanMgr.getConfig();
        ActivityInfo activityInfo = ShuShanMgr.getActivityInfo();
        if (config != null && activityInfo != null) {
            // 宗门令
            addRecycleItemData(activityInfo, config.getSHUSHAN_ITEM_ID_TOKEN(), config.getEXCHANGE_SCORE_ITEM_ID());
            // 快速修行令
            addRecycleItemData(activityInfo, eItemId.SHU_SHAN_GOOD_EXERCISE.getValue(), config.getEXCHANGE_SCORE_ITEM_ID());
        }
    }

    private void addRecycleItemData(ActivityInfo activityInfo, int itemId, int scoreId) {
        List<String> paramList = new ArrayList<>();
        long recycleTime = activityInfo.getEndTime() * 1000L + 600 * 1000;
        paramList.add(String.valueOf(itemId));
        paramList.add(String.valueOf(scoreId));
        paramList.add("2");
        paramList.add(activityInfo.getActivityName());
        ActivityItemRecycleMgr.addRecycleItemData(itemId, activityType, 1, recycleTime, paramList);
    }

    @Override
    protected void initActivityType() {
        activityType = eActivityType.ShuShanActivity.getValue();
    }

    @Override
    protected void doRecycle(long userId, ActivityItemRecycleData data) {
        item2Score(userId, data);
    }

    @Override
    public boolean isActivityRunning() {
        return false;
    }
}
